#!/bin/bash
# Template script di compilazione per la sistribuzione qst
# Created by:
# QSD Sistemi srl
# www.qsdsistemi.it
#
# Lo scripts ha bisogno della path di installazione e della board come parametro
# $1 INSTALL_PATH
# $2 BOARD

# Recupero parametri
if [ $# -ne 2 ]; then
   exit 1;
else
   INSTALL_PATH=$1
   BOARD=$2
fi

# Include
. $INSTALL_PATH/configs/default.conf
. $INSTALL_PATH/$BOARD/configs/.config

export CROSS_COMPILE=${CONFIG_TOOLCHAIN_BIN}
export CC=${CROSS_COMPILE}gcc
export CXX=${CROSS_COMPILE}g++
export CPP=${CROSS_COMPILE}cpp
export LD=${CROSS_COMPILE}ld
export AR=${CROSS_COMPILE}ar
export AS=${CROSS_COMPILE}as
export NM=${CROSS_COMPILE}nm
export STRIP=${CROSS_COMPILE}strip
export RANLIB=${CROSS_COMPILE}ranlib
export OBJDUMP=${CROSS_COMPILE}objdump
export CROSS_PREFIX=${INSTALL_PATH}/${BOARD}/rootfs/rootfs-selected/rootfs/usr/local
export LDFLAGS="-L${CROSS_PREFIX}/lib"
export CFLAGS="-I${CROSS_PREFIX}/include"
export CXXFLAGS="-I${CROSS_PREFIX}/include"
export CPPFLAGS="-I${CROSS_PREFIX}/include"
export PKG_CONFIG_PATH="${CROSS_PREFIX}/lib/pkgconfig:${CROSS_PREFIX}/share/pkgconfig"

make install